package com.mgface.springdata.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import java.util.Set;

/**
 * @author wanyuxiang
 * @version 1.0
 * @project springdataCollection
 * @create 2018-08-17 10:14
 **/
@EqualsAndHashCode(callSuper = true)
@Entity
@Data
public class Student extends BaseEntity{
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private long id;
    @Column(unique = true,nullable = false)
    private String name;
    @ManyToOne(cascade = CascadeType.ALL)
    private School school;
    @OneToMany(cascade = CascadeType.ALL)
    private Set<Curriculum> curriculum;
    @OneToOne(cascade = CascadeType.ALL)
    private Bag bag;

}
